package com.xplus.owe.util;

import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @author ：leon
 * @date ：Created in 2022/4/30 23:26
 * @description：
 * @modified By：
 */
public class ServletUtils {
        /**
         * 获取request
         */
        public static HttpServletRequest getRequest() {
            return getRequestAttributes().getRequest();
        }

        public static ServletRequestAttributes getRequestAttributes() {
            RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
            return (ServletRequestAttributes) attributes;
        }
}
